﻿@model IEnumerable<scheduleMVC.Models.TasksModel>

@{
    ViewBag.Title = "Index";
}

@*<div class="progress progress-striped active">
    <div class="progress-bar" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 45%">
        <span class="sr-only">45% Complete</span>
    </div>
</div>*@

@*<div class="alert alert-success">@ViewBag.message</div>*@
<ul class="pager">
    <span class="label label-success">@ViewBag.message</span></ul>

    <p>
        @Html.ActionLink("Create New", "Create")
    </p>
    <table class="table table-striped table-hover">
    <tr>
        <th>
            <span class="label label-warning">@Html.DisplayNameFor(model => model.Name)</span>

        </th>
        <th>

            <span class="label label-warning">@Html.DisplayNameFor(model => model.StartDate)</span>
        </th>
        <th>

            <span class="label label-warning">@Html.DisplayNameFor(model => model.DueDate)</span>
        </th>
        <th>

            <span class="label label-warning">@Html.DisplayNameFor(model => model.Complete)</span>
        </th>
        <th>

            <span class="label label-warning">@Html.DisplayNameFor(model => model.Status)</span>
        </th>
        <th>

            <span class="label label-warning">@Html.DisplayNameFor(model => model.Description)</span>
        </th>

        <th>

            <span class="label label-warning">@Html.DisplayName("Assigned to")</span>
        </th>
        <th>

            <span class="label label-warning">@Html.DisplayName("Customer")</span>
        </th>
        <th>

            <span class="label label-warning">@Html.DisplayNameFor(model => model.Files.FirstOrDefault().Name)</span>
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.StartDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DueDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Complete)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Status)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Description)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Employee.FirstName)
            </td>

            <td>
                @Html.DisplayFor(modelItem => item.Customer.Business_Name)
            </td>
            <td>


                @foreach (var item2 in item.Files)
                {
                    @Html.ActionLink(item2.Name, "DownloadFile", "DropBox", new { filePath = (item2.FolderPath + "/" + item2.Name), taction = "index", tcontroller = "Task" }, null)
                    <p></p>
                }

            </td>

            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.TasksID }) |
                @Html.ActionLink("Details", "Details", new { id = item.TasksID }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.TasksID })
            </td>
        </tr>
    }

</table>

